<?php

namespace apiend\modules\dynamic\controllers;

use Yii;
use apiend\components\Controller;

/**
 * 视频话题列表
 * Default controller for the `dynamic` module
 */
class DynamicTopicController extends Controller {

    public $modelClass = 'api\modules\dynamic\models\DynamicTopicSearch';

    /**
     * {@inheritdoc}
     */
    public function actions() {
        return [
            'view' => [
                'class' => 'yii\rest\ViewAction',
                'modelClass' => $this->modelClass,
            ],
        ];
    }

    /**
     * 根据话题搜索动态
     * @inheritdoc
     */
    public function actionIndex() {
        /* @var $modelClass \api\modules\dynamic\models\DynamicTopicSearch */
        $modelClass = new $this->modelClass;
        return $modelClass->search(Yii::$app->request->getQueryParams());
    }

}
